import Vue from 'vue'
import VueRouter from 'vue-router'

import LayoutView from "@/views/LayoutView.vue"
import HomeViewVue from '@/views/HomeView.vue'
import OrderView from "@/views/OrderView.vue"
import MineView from "@/views/MineView"

import CartView from "@/views/cart/CartView.vue"

import OrderDetailView from "@/views/OrderDetail.vue"
// 安装路由插件
Vue.use(VueRouter)


// 一般来说，建议不超过三层  
// re  重新    retry 
const routes = [
  {
    path: "/",
    component: LayoutView,
    redirect: "/home",  // 重定向
    children: [
      {
        path: "/home",
        component: HomeViewVue
      },
      {
        path: "/order",
        component: OrderView
      },
      {
        path: "/mine",
        component: MineView
      },
    ]
  },
  {
    path: "/cart",
    component: CartView
  },
  {
    path: "/order-detail",
    component: OrderDetailView
  }

]

const router = new VueRouter({
  routes,
  linkExactActiveClass: "exact-active",
  linkActiveClass: "active"
})

export default router
